package com.mz.ozy.activity.me;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.EditText;
import android.widget.TextView;

import com.mz.ozy.R;
import com.mz.ozy.base.BaseActivity;
import com.mz.ozy.bean.NewMyExtendBean;
import com.mz.ozy.bean.NewMyExtendInfoBean;
import com.mz.ozy.mvp.presenter.ExtendPresenter;
import com.mz.ozy.mvp.view.ExtendContract;

import butterknife.BindView;
import butterknife.ButterKnife;


public class MyExtendDetailActivity extends BaseActivity<ExtendContract.View, ExtendPresenter> implements ExtendContract.View {

    @BindView(R.id.tv_bind_name)
    TextView tvBindName;

    @BindView(R.id.tv_bind_id)
    TextView tvBindId;

    @BindView(R.id.tv_bind_tj)
    TextView tvBindTJ;

    @BindView(R.id.tv_bind_tj_num)
    TextView tvBindTjNum;

    @BindView(R.id.tv_bind_level)
    TextView tvBindLevel;

    @BindView(R.id.tv_bind_bonus)
    TextView tvBindBonus;

    @BindView(R.id.tv_bind_buy_time)
    TextView tvBindBuyTime;

    String type ="";
    String id = "";
    NewMyExtendInfoBean extendInfoBean;

    public static void go(Context context, String id, String type) {
        Intent intent = new Intent(context, MyExtendDetailActivity.class);
        intent.putExtra("id", id);
        intent.putExtra("type", type);
        context.startActivity(intent);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_extend_detail);
        ButterKnife.bind(this);

        id = getIntent().getStringExtra("id");
        type = getIntent().getStringExtra("type");

        initTitle();
        tvCenterTitle.setText("用户详情");

        mPresenter.info(this, id);
    }


    @Override
    public void listSuccess(NewMyExtendBean bean) {

    }

    @Override
    public void infoSuccess(NewMyExtendInfoBean bean) {
        extendInfoBean = bean;

        tvBindName.setText(extendInfoBean.username);
        tvBindId.setText(extendInfoBean.expand);
        tvBindTJ.setText(extendInfoBean.pname);
        tvBindTjNum.setText(extendInfoBean.expNo);
        if ("1".equalsIgnoreCase(type)) {
            tvBindLevel.setText("直接分享用户");
        } else {
            tvBindLevel.setText("间接分享用户");
        }
        tvBindBonus.setText(extendInfoBean.amount);
        tvBindBuyTime.setText(extendInfoBean.time);
    }
}